package com.bayi.storage.activity

import android.app.ActivityManager
import com.bayi.storage.base.BaseActivity
import com.bayi.storage.databinding.ActivityMainBinding
import com.bayi.storage.utils.ToastUtil
import com.bayi.storage.viewModel.MainViewModel

class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {

//    override fun createViewModel(): MainViewModel {
//        return MainViewModel(application)
//    }

    override fun createViewBinding(): ActivityMainBinding {
        return ActivityMainBinding.inflate(layoutInflater)
    }

    override fun initView() {
        binding.cabinetModel = mViewModel.localModelLive.value!!
        binding.viewModel = mViewModel
        mViewModel.localModelLive.observe(this) {
            binding.cabinetModel = mViewModel.localModelLive.value!!
        }
        mViewModel.mTipMsg.observe(this) {
            ToastUtil.show(it.toString())
        }
//        startActivity(Intent(Settings.ACTION_HOME_SETTINGS))
//        val instance = WallpaperManager.getInstance(this)
    }

    override fun onBackPressed() {

    }

    override fun onPause() {
        super.onPause()
        /*
         * 禁用虚拟键-HOME、RECENT
         */
        val activityManager = applicationContext
            .getSystemService(ACTIVITY_SERVICE) as ActivityManager
        activityManager.moveTaskToFront(taskId, 0)
    }

}